package com.spt.springbootzhsx.dao;

import com.spt.springbootzhsx.entity.back.CommentBack;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;

@Mapper
public interface CommentDao {
    @Select("select coid,user.uid,comment.mid,mname,comment.desn,comment.addTime,username,headsrc " +
            "from comment,user,movie " +
            "where comment.uid=user.uid and comment.mid=movie.mid and comment.mid=#{mid}")
    ArrayList<CommentBack> getCommentByMid(Integer mid);

   @Select("select coid,user.uid,comment.mid,mname,comment.desn,comment.addTime,username,headsrc " +
           "from comment,user,movie " +
           "where comment.uid=user.uid and comment.mid=movie.mid and mname like #{mname}")
    ArrayList<CommentBack> getCommentByMname(String mname);

    @Select("select coid,user.uid,comment.mid,mname,comment.desn,comment.addTime,username,headsrc " +
            "from comment,user,movie " +
            "where comment.uid=user.uid and comment.mid=movie.mid and username=#{username}")
    ArrayList<CommentBack> getCommentByUsername(String username);

    @Select("select coid,user.uid,comment.mid,mname,comment.desn,comment.addTime,username,headsrc " +
            "from comment,user,movie " +
            "where comment.uid=user.uid and comment.mid=movie.mid")
    ArrayList<CommentBack> getAllComment();
}
